#pragma once

#if _IS_UI_FOCUS_ENABLED_
#include "IXFocusMgr.h"
#include "XBaseObjImpl.h"

#include <list>

class CXFocusMgrImpl : public CXBaseObjImpl<IXFocusMgr>
{
    typedef CXBaseObjImpl<IXFocusMgr> superclass;
    DEF_SKIN_CLASS_SINGLE_INTF(CXFocusMgrImpl,
        superclass,
        gs_strGuidXSkin,
        IXFocusMgr,
        0);

public:
    CXFocusMgrImpl();
    virtual ~CXFocusMgrImpl();

public:
    // IXFocusMgr
    virtual HRESULT STDMETHODCALLTYPE   AddFocusNode(IXFrame* pFrame);
    virtual HRESULT STDMETHODCALLTYPE   RemoveFocusNode(IXFrame* pFrame);
    virtual HRESULT STDMETHODCALLTYPE   RemoveWindow(IXWindow* pWindow);

    virtual HRESULT STDMETHODCALLTYPE   GetPrevFocusNode(IXFrame** ppFocus);
    virtual HRESULT STDMETHODCALLTYPE   GetNextFocusNode(IXFrame** ppFocus);
    virtual HRESULT STDMETHODCALLTYPE   GetCurrentFocusNode(IXFrame** ppFocus);

public:
    // IXBaseObj
    virtual void    STDMETHODCALLTYPE OnFinalRelease();

protected:
    IXFrame*        SetFocusFrame(IXFrame* pFocusFrame);
    BOOL            IsValidFocusFrame(IXFrame* pFocusFrame);

protected:
    IXFrame*        m_pFocusFrame;

    typedef std::list<IXFrame*> FocusFrameList;
    FocusFrameList      m_FocusFrameList;
};


#endif // _IS_UI_FOCUS_ENABLED_